package j04zuoye;

import java.awt.*;

class Rectangle{
    private Point start;
    private double width;
    private double height;

    public Rectangle() {
    }

    public Rectangle(Point start, double width, double height) {
        this.start = start;
        this.width = width;
        this.height = height;
    }

    public boolean isIntersect(Rectangle rect){
        if(
                rect.getStart().x>=start.x+width ||
                rect.getStart().x+ rect.getWidth() <= start.x ||
                rect.getStart().y-rect.getHeight()>= start.y ||
                rect.getStart().y <= start.y-height
        ){
            return false;
        }
        return true;
    }

    public Point getStart() {
        return start;
    }

    public void setStart(Point start) {
        this.start = start;
    }

    public double getWidth() {
        return width;
    }

    public void setWidth(double width) {
        this.width = width;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }
}

public class Z2hit {
    public static void main(String[] args) {
        Rectangle r1 = new Rectangle(
            new Point(0,10),
            20,
            10
        );
        Rectangle r2 = new Rectangle(
                new Point(30,10),
                20,
                10
        );
        System.out.println(r1.isIntersect(r2));//false
    }
}
